package com.turing.post.report.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

@SuppressWarnings("serial")
@Entity
@Table(name = "MerchantPastIncome")
@IdClass(MerchantPastIncome.class)
public class MerchantPastIncome implements Serializable {
	String MerchantNo; //商户NO
	String IssueCompanyNo;//发卡商NO
	Date TranDate;//	帐务日期
	BigInteger FeePolicyId;//	手续费策略ID
	Long PastIncome;	//追溯收入
	Date TranTime;    //追溯时间
	BigInteger OperId;	//操作员ID
	String remark;       //备注
	
	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return MerchantNo;
	}
	public void setMerchantNo(String merchantNo) {
		MerchantNo = merchantNo;
	}
	
	@Column(name = "ISSUECOMPANYNO", nullable = false)
	public String getIssueCompanyNo() {
		return IssueCompanyNo;
	}
	public void setIssueCompanyNo(String issueCompanyNo) {
		IssueCompanyNo = issueCompanyNo;
	}
	
	@Id
	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return TranDate;
	}
	public void setTranDate(Date tranDate) {
		TranDate = tranDate;
	}
	
	@Id
	@Column(name = "FEEPOLICYID", nullable = false)
	public BigInteger getFeePolicyId() {
		return FeePolicyId;
	}
	public void setFeePolicyId(BigInteger feePolicyId) {
		FeePolicyId = feePolicyId;
	}
	
	@Column(name = "PASTINCOME", nullable = false)
	public Long getPastIncome() {
		return PastIncome;
	}
	public void setPastIncome(Long pastIncome) {
		PastIncome = pastIncome;
	}
	
	@Column(name = "TRANTIME", nullable = false)
	public Date getTranTime() {
		return TranTime;
	}
	public void setTranTime(Date tranTime) {
		TranTime = tranTime;
	}
	
	@Column(name = "OPERID", nullable = true)
	public BigInteger getOperId() {
		return OperId;
	}
	public void setOperId(BigInteger operId) {
		OperId = operId;
	}
	
	@Column(name = "REMARK", nullable = false)
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] {
				getFeePolicyId(), getMerchantNo(), getTranDate() });
	}

	@Override
	public boolean equals(Object obj) {
		if ((this == obj))
			return true;
		if ((obj == null))
			return false;
		if (!(obj instanceof MerchantDaySettlement))
			return false;
		MerchantPastIncomeDetail other = (MerchantPastIncomeDetail) obj;

		if (!PCPSUtil.compareObject(this.getFeePolicyId(), other
				.getFeePolicyId()))
			return false;

		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;
		return PCPSUtil.compareObject(this.getTranDate(), other.getTranDate());
	}
}
